package com.group56.viewmodel.dto;

import com.sun.javafx.collections.ObservableMapWrapper;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.ObservableList;
import javafx.collections.ObservableMap;

import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

public class CoachScheduleListDTO {
    private StringProperty curDate = new SimpleStringProperty();
    private StringProperty coachId = new SimpleStringProperty();
    //未来五天内的schedule <date, scheduleDtoList>
    private ObservableMap<StringProperty, ObservableList<ScheduleDTO>> scheduleDTOMap;

    //TODO
    public void update(){
        SimpleDateFormat formatter= new SimpleDateFormat("yyyy.MM.dd");

        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        String today = formatter.format(calendar.getTime());
        calendar.add(Calendar.DATE, 1);
        String day1 = formatter.format(calendar.getTime());
        calendar.add(Calendar.DATE, 1);
        String day2 = formatter.format(calendar.getTime());
        calendar.add(Calendar.DATE, 1);
        String day3 = formatter.format(calendar.getTime());
        calendar.add(Calendar.DATE, 1);
        String day4 = formatter.format(calendar.getTime());
        calendar.add(Calendar.DATE, 1);
        String day5 = formatter.format(calendar.getTime());



    }

    public void parse(){}

    public CoachScheduleListDTO(String curDate, String coachId) {
        this.curDate.set(curDate);
        this.coachId.set(coachId);
//        this.scheduleDTOMap = new ObservableMapWrapper<>(new HashMap<>(5));
    }

    public String getCoachId() {
        return coachId.get();
    }

    public StringProperty coachIdProperty() {
        return coachId;
    }

    public void setCoachId(String coachId) {
        this.coachId.set(coachId);
    }

    public String getCurDate() {
        return curDate.get();
    }

    public StringProperty curDateProperty() {
        return curDate;
    }

    public void setCurDate(String curDate) {
        this.curDate.set(curDate);
    }

    public ObservableMap<StringProperty, ObservableList<ScheduleDTO>> getScheduleDTOMap() {
        return scheduleDTOMap;
    }

    public void setScheduleDTOMap(ObservableMap<StringProperty, ObservableList<ScheduleDTO>> scheduleDTOMap) {
        this.scheduleDTOMap = scheduleDTOMap;
    }
}
